<template>
  <div>
      <div>
          <el-input v-vmodel="jl.name" placeholder="请输入"></el-input>
            <el-option
                v-for="item in options"
                :key ="item.value"
                :label = "item.label"
                :value = "item.value"
            >

            </el-option>
      </div>
      <div>
          <el-table>
              <el-button @click="addJoblevel">添加</el-button>
              <template slot-scope="scope">
                  <div v-if="scope.row.enabled">
                      成功
                  </div>
                  <div v-else>失败</div>
              </template>
          </el-table>
      </div>
      <template slot-scope="scope">
          <el-button @click="deleteHandle(scope.row)">删除</el-button>
          <el-button @click="showEditView(scope.row)">编辑</el-button>
      </template>
  </div>
</template>

<script>
export default {
    data() {
        return {
            jl:{
                name:'',
                titleLeve:' '
            },
            updateJl:{
                name:'',
                titleLeve:''
            },
            jls:[],
            dialogVisible:false
        }
    },
    methods:{
        doupdate(){
            this.putRequest('url',this.updateJl).then(resp =>{
                if(resp){
                    this.initJls()
                    this.dialogVisible = false
                }
            })
        },
        // 展示编辑框
        showEditView(data){
            //复制数据，在展示的时候
            Object.assign(this.updateJl,data)
            this.updateJl.createDate = ''
            this.dialogVisible = true
        },
        initJls(){
            this.getRequest("/system/basic/joblevel").then(resp =>{
                if(resp){
                    this.jls =resp
                    this.jl.name = ''
                    this.jl.titleLeve = ''
                }
            })
        },
        addJoblevel(){
            if(this.jl.name && this.jl.titleLeve){
                this.postRequest('url',this.jl).then(resp =>{
                    if(resp){
                        this.initJls
                    }
                })
            }else{
                this.$message.error('字段不能为空')
            }
        },
        deleteHandle(data){
            
        }
    },
    mounted(){
        this.initJls()
    }
}
</script>

<style>

</style>